function similarity = compare(pic1, pic2)
    [height, width] = size(pic1);
    count = 0;
    for i = 1 : height
       for j = 1 : width
          diff = pic1(i,j) - pic2(i,j);
          if 0 == diff
             count = count + 1;
          else
             %count = count - 1;
          end
       end
    end
    similarity = count;